package cn.edu.hizee.gps.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;

@RequestMapping("/response")
@RestController
public class ResposeController extends BaseController {

    private Map<String, String> m = new HashMap<String, String>();

    @GetMapping("answer")
    public String answer(HttpServletResponse response, String sentence){
        m.put("回家", "我就在小区门口呢，等你一起回去吧");
        m.put("现在", "我现在刚好没事做，等一下来接你吧");
        m.put("好吗", "好好好，你说怎么样就怎么样");
        m.put("对吗", "对对对，你说的都对");
        String result = "恩";
        for(String key: m.keySet()) {
            if(sentence.indexOf(key) != -1){
                result = m.get(key);
            }
        }
        return ajaxReturn(response,1,"success",result);

    }
}
